<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

//与微信数据交互
Route::match(['get','post'],'wechat/{appid}','WeChatController@index');


//todo  登录验证
//创建菜单
Route::get('create_menu/{appid}','WeChatController@create_menu');

//生成渠道二维码
Route::get('channel_qr','WeChatController@channel_qr');
//发送评价模板消息
Route::post('send_comment_msg','WeChatController@send_comment_msg');
//发送放款通知模板消息
Route::post('send_loan_msg','WeChatController@send_loan_msg');
//发送预约成功模板消息
Route::post('send_reservation_msg','WeChatController@send_reservation_msg');

//来自crm、金贝等业务系统的http请求需要验签
Route::group(['middleware'=>['VerifyHttp','CheckAppId']],function (){
    //生成、展示服务经理二维码
    Route::get('qr','WeChatController@show_manager_qr');

    //接受模板消息请求
    Route::post('receive_temp_msg','WeChatController@receive_temp_msg');

});

//发送模板消息
Route::get('send_temp_msg','WeChatController@send_temp_msg');

Route::group(['middleware'=>'CheckAppId'],function (){
    //微信网页授权获取用户信息
    Route::get('wechat_user_info','WeChatController@wechat_user_info');

    //微信js-sdk接入生成签名
    Route::get('wechat_js_sign','WeChatController@wechat_js_sign');

    //通过openid获取用户微信信息
    Route::get('get_userinfo_by_openid','WeChatController@get_userinfo_by_openid');
});

Route::get('sign','WeChatController@sign');